+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
+Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c: make maximum digits compile time configurable
+ via MAX_DIGITS and up to 20. 5 was just ridiculously small.
+ don't use automatic fixed size buffer for printf-ing floats, doubles
+ can expand to really _huge_ strings, use g_strdup_printf() instead.
+
Wed Jun 20 04:28:24 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c (gtk_range_class_init): hum, "adjustment" was a
#define ARROW_SIZE 11
#define SPIN_BUTTON_INITIAL_TIMER_DELAY 200
#define SPIN_BUTTON_TIMER_DELAY 20
-#define MAX_TEXT_LENGTH 256
#define MAX_TIMER_CALLS 5
#define EPSILON 1e-5
+#define MAX_DIGITS 20
enum {
PROP_0,
_("Digits"),
_("The number of decimal places to display"),
0,
- 5,
+ MAX_DIGITS,
0,
G_PARAM_READWRITE));
static gint
gtk_spin_button_default_output (GtkSpinButton *spin_button)
{
- gchar buf[MAX_TEXT_LENGTH];
+ gchar *buf = g_strdup_printf ("%0.*f", spin_button->digits, spin_button->adjustment->value);
- sprintf (buf, "%0.*f", spin_button->digits, spin_button->adjustment->value);
if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (spin_button))))
gtk_entry_set_text (GTK_ENTRY (spin_button), buf);
+ g_free (buf);
return FALSE;
}
digits = 0;
else {
digits = abs ((gint) floor (log10 (fabs (step))));
- if (digits > 5)
- digits = 5;
+ if (digits > MAX_DIGITS)
+ digits = MAX_DIGITS;
}
gtk_spin_button_configure (spin, GTK_ADJUSTMENT (adj), step, digits);
* @spin_button: a #GtkSpinButton
* @digits: the number of digits to be displayed for the spin button's value
*
- * Set the precision to be displayed by @spin_button. Up to 5 digit precision
+ * Set the precision to be displayed by @spin_button. Up to 20 digit precision
* is allowed.
**/
void
guint button : 2;
guint need_timer : 1;
guint timer_calls : 3;
- guint digits : 3;
+ guint digits : 10;
guint numeric : 1;
guint wrap : 1;
guint snap_to_ticks : 1;